inherited crdKindsman: TcrdKindsman
  Left = 520
  Top = 467
  VertScrollBar.Range = 0
  BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
  BorderStyle = bsDialog
  Caption = #1057#1086#1079#1076#1072#1085#1080#1077' '#1088#1086#1076#1089#1090#1074#1077#1085#1085#1086#1081' '#1089#1074#1103#1079#1080
  ClientHeight = 197
  ClientWidth = 394
  OldCreateOrder = True
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object Label4: TLabel [0]
    Left = 6
    Top = 121
    Width = 74
    Height = 13
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1089' '#1076#1072#1090#1099
  end
  object Label5: TLabel [1]
    Left = 6
    Top = 149
    Width = 74
    Height = 13
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1087#1086' '#1076#1072#1090#1091
  end
  object Label3: TLabel [2]
    Left = 6
    Top = 84
    Width = 74
    Height = 29
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1054#1090#1085#1086#1096#1077#1085#1080#1077#13#10#1088#1086#1076#1089#1090#1074#1077#1085#1085#1080#1082#1072
  end
  object Label2: TLabel [3]
    Left = 6
    Top = 34
    Width = 74
    Height = 13
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1056#1086#1076#1089#1090#1074#1077#1085#1085#1080#1082
  end
  object Label6: TLabel [4]
    Left = 6
    Top = 54
    Width = 74
    Height = 27
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1054#1090#1085#1086#1096#1077#1085#1080#1077#13#10#1075#1088#1072#1078#1076#1072#1085#1080#1085#1072
  end
  object DBText1: TDBText [5]
    Left = 86
    Top = 6
    Width = 300
    Height = 17
    DataField = 'NAME'
    DataSource = crdTenant.dcsClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold, fsUnderline]
    ParentFont = False
  end
  object Label1: TLabel [6]
    Left = 6
    Top = 6
    Width = 74
    Height = 13
    Alignment = taRightJustify
    AutoSize = False
    Caption = #1060#1048#1054
  end
  inherited Panel1: TPanel
    Top = 170
    Width = 394
    inherited BitBtn1: TBitBtn
      Left = 187
    end
    inherited BitBtn2: TBitBtn
      Left = 289
    end
  end
  inherited ToolBar1: TToolBar
    Width = 394
    Height = 0
  end
  object dbtBdate: TDBDateTimeEditEh [9]
    Left = 86
    Top = 118
    Width = 77
    Height = 19
    AlwaysShowBorder = True
    DataField = 'BDATE'
    DataSource = dscKindsman
    EditButtons = <>
    Flat = True
    Kind = dtkDateEh
    TabOrder = 2
    Visible = True
  end
  object dbtEdate: TDBDateTimeEditEh [10]
    Left = 86
    Top = 147
    Width = 77
    Height = 19
    AlwaysShowBorder = True
    DataField = 'EDATE'
    DataSource = dscKindsman
    EditButtons = <>
    Flat = True
    Kind = dtkDateEh
    TabOrder = 3
    Visible = True
  end
  object lcbKinsRelation: TDBLookupComboboxEh [11]
    Left = 86
    Top = 60
    Width = 300
    Height = 19
    AlwaysShowBorder = True
    DataField = 'KINS_RELATION'
    DataSource = dscKindsman
    EditButtons = <>
    Flat = True
    KeyField = 'ID'
    ListField = 'NAME'
    ListSource = dscKinsRelation
    TabOrder = 4
    Visible = True
  end
  object dbeKindsman: TDBLookupComboboxEh [12]
    Left = 86
    Top = 32
    Width = 300
    Height = 19
    AlwaysShowBorder = True
    DataField = 'KINSMAN_ID'
    DataSource = dscKindsman
    EditButtons = <>
    Flat = True
    KeyField = 'ID'
    ListField = 'NAME'
    ListSource = dsc_Arendators
    TabOrder = 5
    Visible = True
  end
  object lcbClientRelation: TDBLookupComboboxEh [13]
    Left = 86
    Top = 89
    Width = 300
    Height = 19
    AlwaysShowBorder = True
    DataField = 'TEN_RELATION'
    DataSource = dscKindsman
    EditButtons = <>
    Flat = True
    KeyField = 'ID'
    ListField = 'NAME'
    ListSource = dscClientRelation
    TabOrder = 6
    Visible = True
  end
  inherited ActionList1: TActionList
    Left = 308
    Top = 14
    inherited aSave: TAction
      OnExecute = aSaveExecute
    end
    inherited aCancel: TAction
      OnExecute = aCancelExecute
    end
  end
  inherited PropStorage: TPropStorageEh
    Left = 220
    Top = 16
  end
  object ds_Arendators: TpFIBDataSet
    SelectSQL.Strings = (
      'select p.client_id as id, (select c.name from clients c '
      '          where c.id = p.client_id) as name,'
      ''
      '    (select c.sex from clients c'
      '          where c.id = p.client_id) as sex,'
      '    (select c.birthdate from clients c'
      '          where c.id = p.client_id) as birthdate'
      ''
      
        '  from p_sel_abontenants_by_period(:pabonent_id, current_date, c' +
        'urrent_date+15) p'
      '  where status > 0'
      '  and p.client_id <> :pclient_id'
      
        '  and not exists(select 1 from family f where f.tenant_id = :pcl' +
        'ient_id and f.kinsman_id = p.client_id)'
      
        '  and not exists(select 1 from family f where f.kinsman_id = :pc' +
        'lient_id and f.tenant_id = p.client_id)'
      'union'
      'select'
      '  c.id as id,'
      '  c.name,'
      '  c.sex,'
      '  c.birthdate'
      'from abonents a, clients c'
      'where a.id = :pabonent_id'
      '  and c.id = a.client_id'
      '  and c.id <> :pclient_id')
    AfterScroll = ds_ArendatorsAfterScroll
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 340
    Top = 13
    poSQLINT64ToBCD = True
    oFetchAll = True
    object ds_ArendatorsID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_ArendatorsNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 92
      EmptyStrToNull = True
    end
    object ds_ArendatorsSEX: TFIBStringField
      FieldName = 'SEX'
      Size = 1
      EmptyStrToNull = True
    end
    object ds_ArendatorsBIRTHDATE: TFIBDateField
      FieldName = 'BIRTHDATE'
    end
  end
  object dsc_Arendators: TDataSource
    DataSet = ds_Arendators
    Left = 368
    Top = 13
  end
  object dsKindsman: TpFIBDataSet
    UpdateSQL.Strings = (
      '')
    InsertSQL.Strings = (
      'INSERT INTO FAMILY('
      '    TENANT_ID,'
      '    KINSMAN_ID,'
      '    TEN_RELATION,'
      '    KINS_RELATION,'
      '    BDATE,'
      '    EDATE'
      ')'
      'VALUES('
      '    :TENANT_ID,'
      '    :KINSMAN_ID,'
      '    :TEN_RELATION,'
      '    :KINS_RELATION,'
      '    :BDATE,'
      '    :EDATE'
      ')')
    SelectSQL.Strings = (
      'select'
      'TENANT_ID,'
      'KINSMAN_ID,'
      'TEN_RELATION,'
      'KINS_RELATION,'
      'BDATE,'
      'EDATE'
      '  from family f1'
      'where id is null')
    Transaction = trKindsman
    Database = MAINDM.pMainDatabase
    Left = 340
    Top = 50
    object dsKindsmanTENANT_ID: TFIBIntegerField
      FieldName = 'TENANT_ID'
    end
    object dsKindsmanKINSMAN_ID: TFIBIntegerField
      FieldName = 'KINSMAN_ID'
    end
    object dsKindsmanTEN_RELATION: TFIBIntegerField
      FieldName = 'TEN_RELATION'
    end
    object dsKindsmanKINS_RELATION: TFIBIntegerField
      FieldName = 'KINS_RELATION'
    end
    object dsKindsmanBDATE: TFIBDateField
      FieldName = 'BDATE'
    end
    object dsKindsmanEDATE: TFIBDateField
      FieldName = 'EDATE'
    end
  end
  object trKindsman: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 306
    Top = 50
  end
  object dscKindsman: TDataSource
    DataSet = dsKindsman
    Left = 368
    Top = 49
  end
  object dsClientRelation: TpFIBDataSet
    SelectSQL.Strings = (
      'select p.id, p.name'
      '  from pas_rrelation p, pas_rrelation_type pt, pas_rrelation p2'
      
        '  where (p.sex = :sex or coalesce(cast(:sex as varchar(1)),'#39#39') =' +
        ' '#39#39')'
      
        '    and (p2.sex = :sex2 or coalesce(cast(:sex2 as varchar(1)),'#39#39 +
        ') = '#39#39')'
      '    and p2.id = pt.relation2'
      '    and p.id = pt.relation1'
      '  union'
      ' select p.id, p.name'
      '  from pas_rrelation p, pas_rrelation_type pt, pas_rrelation p2'
      
        '  where (p.sex = :sex or coalesce(cast(:sex as varchar(1)),'#39#39') =' +
        ' '#39#39')'
      
        '    and (p2.sex = :sex2 or coalesce(cast(:sex2 as varchar(1)),'#39#39 +
        ') = '#39#39')'
      '    and p2.id = pt.relation1'
      '    and p.id = pt.relation2'
      ' order by 2')
    AfterScroll = dsClientRelationAfterScroll
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 340
    Top = 81
    poSQLINT64ToBCD = True
    oFetchAll = True
    object dsClientRelationID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsClientRelationNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object dscClientRelation: TDataSource
    DataSet = dsClientRelation
    Left = 368
    Top = 81
  end
  object dsKinsRelation: TpFIBDataSet
    SelectSQL.Strings = (
      'select id, name'
      '  from pas_rrelation p, pas_rrelation_type pr'
      
        '  where (p.sex = :sex or coalesce(cast(:sex as varchar(1)),'#39#39') =' +
        ' '#39#39')'
      '    and ((p.id = pr.relation1 and pr.relation2 = :relation)'
      '         or'
      '         (p.id = pr.relation2 and pr.relation1 = :relation))'
      '  order by name')
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 340
    Top = 113
    poSQLINT64ToBCD = True
    oFetchAll = True
    object dsKinsRelationID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsKinsRelationNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object dscKinsRelation: TDataSource
    DataSet = dsKinsRelation
    Left = 368
    Top = 113
  end
end
